﻿@page "/Logout"
@using System
@layout SimpleLayout
@using Kite.Gateway.Admin.Core
@using Mapster
@using Kite.Gateway.Domain.Shared.Enums
@inject ToastService ToastService
@inject NavigationManager NavigationManager
@inject AuthorizationServerStorage AuthorizationServerStorage


<main class="form-signin text-center">
  <form>
    <img class="mb-4" src="/images/kitelogo.png" alt="" width="72" height="57">
    <h1 class="h3 mb-3 fw-normal">正在退出登录...</h1>
    <Spinner Color="Color.Primary"></Spinner>
  </form>
</main>

@code {
    protected override void OnInitialized()
    {
        base.OnInitialized();
        //如果没有登录则跳转到登录页面
        if (!AuthorizationServerStorage.IsLogin())
        {
            NavigationManager.NavigateTo("/Login");
        }
        else
        {
            //清理服务器登录存储信息
            AuthorizationServerStorage.DeleteServerStorage();
            //跳转到登录页面
            NavigationManager.NavigateTo("/Login");
           
        }
    }
}
